Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type system / manager overhaul #1199

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Type system / manager overhaul #1199

merged 1 commit into from
Jul 27, 2023

Conversation

oxisto
Copy link
Member

@oxisto oxisto commented Jun 11, 2023

Prep Work

  • Converting TypeManager to Kotlin
  • Introduce a new ProblemType, similar to ProblemDeclaration and ProblemExpression
  • Create two new functions newPrimitiveType and newObjectType as part of the node builders

Frontends

C/C++ Frontend

  • Replace creation of primitive types with newPrimitiveType instead of calling the type parser
  • Replace all calls to parseType with type parsing in frontend and newObjectType

Java Frontend

  • Replace creation of primitive types with newPrimitiveType instead of calling the type parser
  • Replace all calls to parseType with type parsing in frontend and newObjectType

LLVM Frontend

  • Replace creation of primitive types with newPrimitiveType instead of calling the type parser
  • Replace all calls to parseType with type parsing in frontend and newObjectType

TypeScript Frontend

  • Replace creation of primitive types with newPrimitiveType instead of calling the type parser
  • Replace all calls to parseType with type parsing in frontend and newObjectType

Go Frontend

  • Replace creation of primitive types with newPrimitiveType instead of calling the type parser
  • Replace all calls to parseType with type parsing in frontend and newObjectType

Python Frontend

  • Replace creation of primitive types with newPrimitiveType instead of calling the type parser
  • Replace all calls to parseType with type parsing in frontend and newObjectType

Cleanup

  • Removing TypeParser
  • Cleaning up some stuff
  • Build C++ primitive types in a canonical way (e.g., unsigned long long int) to correctly parse all primitive types
  • Harmonise the way frontends parse/construct type information (e.g. using a typeOf function in the LanguageFrontend)

@oxisto oxisto force-pushed the type-system-overhaul branch 3 times, most recently from 5c6b31c to 2aad863 Compare June 11, 2023 21:21
@oxisto
Copy link
Member Author

oxisto commented Jun 13, 2023

First iteration of this is done. Before I cleanup the type manager itself any more... any first feedback on this?

cc @maximiliankaul @KuechA @konradweiss

Copy link
Contributor

@KuechA KuechA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a very good idea to let the frontends generate and parse the types as they have more (specific and relevant) information available and we do not have to assemble a string only to parse it again. I also think that adding this to a frontend shouldn't be problematic in most cases.

It would be good to have one method in the LanguageFrontend which has to be implemented by their instances to generate the type. Currently, they have a different name everywhere. I'd also appreciate to have a common usage pattern provided by the node builder (e.g. pointer(primitiveType("int")) instead of primitiveType("int").reference(POINTER) or so). I think this is not consistent yet.

@sonarcloud
Copy link

sonarcloud bot commented Jun 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 23 Code Smells

83.7% 83.7% Coverage
1.4% 1.4% Duplication

@oxisto oxisto force-pushed the type-system-overhaul branch 4 times, most recently from 5e814e1 to 6b307b5 Compare July 19, 2023 20:48
@oxisto oxisto marked this pull request as ready for review July 19, 2023 21:10
@oxisto oxisto force-pushed the type-system-overhaul branch 7 times, most recently from ee38bd0 to 3b6e111 Compare July 24, 2023 17:19
@oxisto oxisto mentioned this pull request Jul 25, 2023
@oxisto oxisto force-pushed the type-system-overhaul branch 3 times, most recently from ba0de3f to 340a5f8 Compare July 26, 2023 17:23
@oxisto oxisto force-pushed the type-system-overhaul branch 2 times, most recently from 5338ea5 to 07ffc9d Compare July 27, 2023 10:06
@sonarcloud
Copy link

sonarcloud bot commented Jul 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

81.1% 81.1% Coverage
1.6% 1.6% Duplication

Copy link
Collaborator

@konradweiss konradweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTU

@oxisto oxisto merged commit 6f4ca17 into main Jul 27, 2023
3 checks passed
@oxisto oxisto deleted the type-system-overhaul branch July 27, 2023 12:56
oxisto added a commit that referenced this pull request Jul 27, 2023
oxisto added a commit that referenced this pull request Jul 27, 2023
This PR contains a complete re-write of the Go language frontend based on JNA instead of a pure Go implementation. While this has a slight performance drawback (I am working on providing some numbers), it has infinitly better debugging capabilities. The handlers and most of the frontend itself is written in Kotlin using our classes and we than use a JNA bridge to a C API wrapper around the Go `go/ast` package.

Depends on #1199

Fixes #1256
Fixes #1257
Fixes #1258
Fixes #1259
oxisto added a commit that referenced this pull request Jul 27, 2023
This PR contains a complete re-write of the Go language frontend based on JNA instead of a pure Go implementation. While this has a slight performance drawback (I am working on providing some numbers), it has infinitly better debugging capabilities. The handlers and most of the frontend itself is written in Kotlin using our classes and we than use a JNA bridge to a C API wrapper around the Go `go/ast` package.

Depends on #1199

Fixes #1256
Fixes #1257
Fixes #1258
Fixes #1259
oxisto added a commit that referenced this pull request Jul 31, 2023
This PR contains a complete re-write of the Go language frontend based on JNA instead of a pure Go implementation. While this has a slight performance drawback (I am working on providing some numbers), it has infinitly better debugging capabilities. The handlers and most of the frontend itself is written in Kotlin using our classes and we than use a JNA bridge to a C API wrapper around the Go `go/ast` package.

Depends on #1199

Fixes #1256
Fixes #1257
Fixes #1258
Fixes #1259
oxisto added a commit that referenced this pull request Jul 31, 2023
This PR contains a complete re-write of the Go language frontend based on JNA instead of a pure Go implementation. While this has a slight performance drawback (I am working on providing some numbers), it has infinitly better debugging capabilities. The handlers and most of the frontend itself is written in Kotlin using our classes and we than use a JNA bridge to a C API wrapper around the Go `go/ast` package.

Depends on #1199

Fixes #1256
Fixes #1257
Fixes #1258
Fixes #1259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants